﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Solidi
{
	internal static class DependencyExtensions
	{
		internal static IDependency Coalesce(this IDependency source, IDependencyKey key = null, Func<IDependencyContainer, IDependency, object> factory = null, IDependencyLifestyle lifestyle = null, IEnumerable<IDependencyParameter> parameters = null)
		{
			return new Dependency
			(
				key: key ?? source.Key,
				factory: factory ?? source.Factory,
				lifestyle: lifestyle ?? source.Lifestyle,
				parameters: parameters ?? source.Parameters
			);
		}
	}
}
